import {
  getList,
  addList,
  updateList,
  deleteList
} from '@/api/classify.js';

export default {
  namespaced: true,
  state: {
      list: []
  },
  mutations: {
      setList(state, data) {
          state.list = data
      }
  },
  actions: {
      async getListFun({
          commit
      }) {
          let res = await getList();
          commit("setList", res.data)
      },
      async addListFun({
          commit
      }, data) {
          await addList(data);
      },
      async updateListFun({
          commit
      }, data) {
          await updateList(data);
      },
      async deleteListFun({
          commit
      }, id) {
          await deleteList(id);
      },
  },
}